home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d13 / readcpm.arc / MACROS.ASM < prev    next >
Assembly Source File  |  1989-05-30  |  1KB  |  71 lines

  1.  
  2.     COMMENT    \
  3.         Macro to generate a FAR return, regardless of the PROC type.
  4. \
  5. RETF    MACRO    $$COUNT
  6.     IFB    <&$$COUNT>        ;; Is there a pop count?
  7.     DB    0CBH            ;; No, just do the return
  8.     ELSE
  9.     DB    0CAH                    ;; Define the instruction
  10.     DW    &$$COUNT        ;; And the pop count
  11.     ENDIF
  12. ENDM    ; RETF
  13.  
  14.     COMMENT \
  15.     Macro to generate a NEAR return, regardless of the PROC type.
  16. \
  17. RETN    MACRO    $$COUNT
  18.     IFB    <&$$COUNT>        ;; Is there a pop count?
  19.     DB    0C3H                    ;; No, just do the return
  20.     ELSE                ;; Otherwise...
  21.     DB    0C2H            ;; Generate the return
  22.     DW    &$$COUNT        ;; And the pop count
  23.     ENDIF
  24. ENDM    ; RETN
  25.  
  26.     COMMENT \
  27.     Macro to generate exit to DOS, allowing for exit code.
  28. \
  29. $EXIT    MACRO    $$CODE
  30.     IFB    <$$CODE>
  31.     MOV    AX,4C00H
  32.     ELSE
  33.     MOV    AX,(4CH*256)+&$$CODE
  34.     ENDIF
  35.     INT    21H
  36. ENDM    ; $EXIT
  37.  
  38. SAVE    MACRO    P1,P2,P3,P4,P5,P6,P7,P8,P9
  39.     IRP    Y,<P1,P2,P3,P4,P5,P6,P7,P8,P9>
  40.     IFNB    <Y>
  41.     PUSH    Y
  42.     ENDIF
  43.     ENDM
  44. RESTORE MACRO
  45.     IRP    Z,<P9,P8,P7,P6,P5,P4,P3,P2,P1>
  46.     IFNB    <Z>
  47.     POP    Z
  48.     ENDIF
  49.     ENDM
  50.     ENDM
  51.     ENDM
  52.  
  53.  
  54. SAVE_REG    MACRO    P1,P2,P3,P4,P5,P6,P7,P8,P9
  55.     IRP    Y,<P1,P2,P3,P4,P5,P6,P7,P8,P9>
  56.     IFNB    <Y>
  57.     PUSH    Y
  58.     ENDIF
  59.     ENDM
  60. RESTORE MACRO
  61.     IRP    Z,<P9,P8,P7,P6,P5,P4,P3,P2,P1>
  62.     IFNB    <Z>
  63.     POP    Z
  64.     ENDIF
  65.     ENDM
  66.     ENDM
  67.     ENDM
  68.  
  69.  
  70.  
  71.